package com.xianyun.site.iblog.user.executor;

import com.alibaba.cola.catchlog.CatchAndLog;
import com.alibaba.cola.dto.Response;
import com.xianyun.site.iblog.api.user.dubbo.SocialUserEchoService;
import com.xianyun.site.iblog.dto.user.SocialUserAddCmd;
import com.xianyun.site.iblog.dto.user.SocialUserBindCmd;
import com.xianyun.site.iblog.user.executor.command.SocialUserAddCmdExo;
import com.xianyun.site.iblog.user.executor.command.SocialUserBindCmdExo;
import org.apache.dubbo.config.annotation.Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import javax.validation.Valid;

/**
 * @author mac_zyj
 */
@Service
@CatchAndLog
@Component
public class SocialUserEchoServiceImpl implements SocialUserEchoService {

    @Autowired
    private SocialUserBindCmdExo socialUserBindCmdExo;

    @Autowired
    private SocialUserAddCmdExo socialUserAddCmdExo;

    @Override
    public Response checkAndInsertAuthToken(@Valid SocialUserAddCmd cmd) {
        return socialUserAddCmdExo.execute(cmd);
    }

    @Override
    public Response bindSocialUserAndUser(SocialUserBindCmd cmd) {
        return socialUserBindCmdExo.execute(cmd);
    }
}
